#include <stdio.h>
#include <iostream>
#include <set>

using namespace std;

void SortRemoveDuplicates(int arr[], int &length)
{
	if(!arr || !length)
		return;
	set<int> intset;
	set<int>::iterator iter;
	for(int i = 0; i < length; i++)
	{
		intset.insert(arr[i]);
	}	
	
	length = intset.size();
	int i = 0;
	for(iter = intset.begin(); iter != intset.end(); iter++)
	{
		arr[i++] = *iter;
	}
}


void main()
{
	int arr[] = {1,7,3,2,8,4,6,2,4};
	int length = 9;
	SortRemoveDuplicates(arr, length);
	for(int i = 0; i < length; i++)
		cout << arr[i];
}